testStr = "testStr"

a = '123.456.789'

print(a.rsplit('.', 1))
print(a.rsplit('.', 2))


# python 不需要 ref 和 out 参数 ，辅助函数 返回值
def maxminValue(alist):
    global x, y  # 不能为global变量直接赋值。必须先引入
    x = max(alist)
    y = min(alist)
    return x + y, x * y


a, b = maxminValue([3, 2, 5, 4, 8, 6, 9])
print(a, b)  # 11,18
print(x, y)  # 9,2


class Circle(object):
    def __init__(self, radius):
        self.radius = radius

    @property
    def diameter(self):
        return self.radius * 2

    @diameter.setter
    def diameter(self, new_diameter):
        self.radius = new_diameter / 2


my_circle = Circle(3)

my_circle.diameter = 4

print('radius is {}'.format(my_circle.radius))
print('diameter is {}'.format(my_circle.diameter))
